import { ExtractPropTypes, PropType } from "vue";

export type NilThinTableColumn = {
  prop: string;
  label: string;
  width?: string;
  type?: string;
  formatter?: boolean;
  fixed?: boolean;
};

type NilThinTableFormatterFun = (prop: string, data: string) => string;

export const thinTableProps = {
  loading: {
    type: Boolean,
    default: false,
  },

  data: {
    type: Array,
    default: () => [],
  },

  columns: {
    type: Array as PropType<NilThinTableColumn[]>,
    default: () => [],
  },

  formatter: {
    type: Function as PropType<NilThinTableFormatterFun>,
    default: () => {},
  },
  stripe: Boolean,
  border: Boolean,
};

export type ThinTableProps = ExtractPropTypes<typeof thinTableProps>;
